<template>
  <div>
    <Head title="企业信息" isBack>
      <template #content>
        <Detail
          :columns="1"
          :form="detailForm"
          :detail="data.detailData"
          :labelWidth="120"
          align="left"
        ></Detail>
      </template>
    </Head>
    <Head title="其他信息">
      <template #content>
        <Detail
          :columns="1"
          :form="detailForm1"
          :detail="data.detailData"
          :labelWidth="120"
          align="left"
        ></Detail>
      </template>
    </Head>
  </div>
</template>

<script lang="ts" setup>
import Head from '@/components/head/index.vue';
import Detail from '@/components/form/detail.vue';
import { queryChannelDetail } from '@/service/apis/channel';

const route = useRoute();
const {
  query: { id },
} = route;

const detailForm = reactive([
  {
    label: '企业名称',
    prop: 'orgName',
  },
  {
    label: '运营商名称',
    prop: 'operatorName',
  },
  {
    label: '企业注册地址',
    prop: 'address',
  },
  {
    label: '统一社会信用代码',
    prop: 'code',
  },
  {
    label: '归属城市',
    prop: 'cityName',
  },
  {
    label: '签约时间',
    prop: 'signStartTime',
    template: (row: any) => {
      return row.signStartTime || row.signEndTime
        ? `${row.signStartTime}-${row.signEndTime}`
        : '--';
    },
  },
]);
const detailForm1 = reactive([
  {
    label: '联系人',
    prop: 'contactUser',
  },
  {
    label: '联系方式',
    prop: 'contactNum',
  },
  {
    label: '联系地址',
    prop: 'contactAddress',
  },
  {
    label: '联系邮箱',
    prop: 'email',
  },
  {
    label: '营业执照',
    prop: 'businessLicense',
    type: 'image',
  },
  {
    label: '企业图标',
    prop: 'businessLogo',
    type: 'image',
  },
  {
    label: '备注说明',
    prop: 'remark',
  },
]);
const data = reactive({
  detailData: {} as any,
});

queryChannelDetail({ id: id }).then((res: any) => {
  if (res) {
    data.detailData = res;
  }
});
</script>